home *** CD-ROM | disk | FTP | other *** search
- /********************************************************************************/
- /* */
- /* status.c - status request processing. */
- /* */
- /* Richard W. Mincher. February 19, 1990. */
- /* */
- /* Copyright © 1990 Apple Computer, Inc. All rights reserved. */
- /* */
- /********************************************************************************/
-
- #include "AROSE.h"
- #include "os.h"
- #include "managers.h"
-
- #include "ARDriver.h"
- #include "ARTask.h"
-
- static unsigned short csStuff[12];
- static unsigned short csSize;
-
- StatusCall()
- {
- NetCopy( msg->mFrom, msg->mDataPtr, msg->mTo, csStuff, 24 );
-
- #ifdef DEBUG
- printf("Status received. mDataPtr = %x, mDataSize = %x, csCode=%x\n",
- msg->mDataPtr, msg->mDataSize, csStuff[0] );
- #endif DEBUG
-
- msg->mStatus = 0;
- switch( csStuff[0] )
- {
- case 2:
- csSize = 4;
- CountInData();
- break;
- case 8:
- csSize = 6;
- GetStatus();
- break;
- default:
- csSize = 0;
- msg->mStatus = -18; /* statusErr */
- }
- NetCopy( msg->mTo, csStuff + 1, msg->mFrom, msg->mDataPtr + 2, csSize );
- }
-
- CountInData()
- {
- unsigned long length;
-
- length = G->rxMax - G->rxCount;
-
- csStuff[1] = (length >> 16) & 0xFFFF;
- csStuff[2] = length & 0xFFFF;
- }
-
- GetStatus()
- {
- csStuff[1] = (G->asyncErr << 8) | G->flowOff;
- csStuff[2] = 0;
- if (G->txQHead)
- csStuff[2] = 0x100;
- if (G->rxQHead)
- csStuff[2] |= 1;
- csStuff[3] = (G->CTSFlag << 8) | G->xOffFlag;
- }
-